SET NOCOUNT ON
SET QUOTED_IDENTIFIER ON
GO

PRINT '---- tblTeams'

PRINT '-- Table title'
INSERT tblUFGTableTitles (utt_Tablename, utt_Languagename, utt_Title, utt_Description)
VALUES ('tblteams','Nederlands','Teams','Team gegevens')

PRINT '-- Column titles'
INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_TeamName','Nederlands','Teamnaam','U dient een teamnaam in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_PoolSeason','Nederlands','Seizoenspoule','U dient een seizoenspoule in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_TeamKind','Nederlands','Teamsoort','U dient een teamsoort in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_ClassName','Nederlands','Klasse','U dient een klasse in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_PoolName','Nederlands','District','U dient een district in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_Clubname','Nederlands','Clubnaam','U dient een clubnaam in te vullen.')

INSERT tblUFGColumnTitles
(uct_TableName,uct_ColumnName,uct_Languagename,uct_Title,uct_SubTitle)
VALUES
('tblTeams','tea_Season','Nederlands','Seizoen','U dient een seizoen in te vullen.')

PRINT '-- Panels'

PRINT '-- Foreign key titles'
INSERT tblUFGForeignKeyTitles (uft_ForeignKeyName,uft_LanguageName,uft_Title,uft_CategoryTitle) VALUES
('FK_mat_HomeClubname','Nederlands','Thuiswedstrijden',NULL),
('FK_mat_AgainstClubname','Nederlands','Uitwedstrijden',NULL)

PRINT '-- Row Rights'

INSERT tblUFGRowRights
(urr_TableName,urr_RoleName,urr_SQLSelectExpression,urr_SQLInsertExpression,urr_SQLUpdateExpression,urr_SQLDeleteExpression)
VALUES
('tblTeams','Technische Commissie Club',
'tea_ClubName = dbo.fnGetClubnameByUser(@UFGUsername)',
null,
'tea_ClubName = dbo.fnGetClubnameByUser(@UFGUsername)',
'tea_ClubName = dbo.fnGetClubnameByUser(@UFGUsername)')

UPDATE tblUFGForeignKeyColumns
SET ufc_AdditionalWhere = 'clb_Name = dbo.fnGetClubnameByUser(@UFGUsername)'
WHERE ufc_ForeignKeyName = 'FK_tea_Clubname'
AND ufc_TableName = 'tblTeams'
AND ufc_ColumnName = 'tea_Clubname'
AND ufc_ReferenceTableName = 'tblClubs'
AND ufc_ReferenceColumnName = 'clb_Name'

PRINT '-- Display'